/**
 * Created by zhulizhe on 2017/8/25.
 */
import React, {Component} from 'react';
import {
    Text,
    View,
    TouchableOpacity,
    Image,
    ScrollView
} from 'react-native';

import {Item} from './PersonInfo'
import Constant from "../Contant";
import loginStore from "../store/LoginStore";
import RequestUtil from "../util/NetUtil";

export default class Setting extends Component {
    render() {
        return <ScrollView style={{flex: 1, backgroundColor: Constant.GRAYBGCOLOR}}>
            <Item
                onClick={() => {
                    this.props.navigation.navigate('AccountMgr')
                }}
                title="账户"/>
            <Item
                title="关于汇贝"/>
            <View style={{marginTop: 20, marginBottom: 40}}>
                <Item
                    title="清除缓存"
                    hiddenArrow={true}/>
            </View>

            <TouchableOpacity
                onPress={() => {
                    loginStore.loginOut();
                    RequestUtil.requestData('login/tourist', {}).then((resp) => {
                        if (resp == undefined) return;
                        LOG('游客登陆' + JSON.stringify(resp));
                        loginStore.save('',resp.access_token,resp.access_secret);
                    })
                }}
                activeOpacity={0.8}
                style={{
                    justifyContent: 'center',
                    alignItems: 'center',
                    backgroundColor: '#fff',
                    paddingVertical: 15,
                    width: '100%',
                    height: 40
                }}>
                <Text>退出登录</Text>
            </TouchableOpacity>
        </ScrollView>
    }
}

